<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="../assets/lib/layui/css/layui.css">
  <link rel="stylesheet" href="../assets/css/article-lists.css">
</head>

<body>
  <div class="layui-card">
    <div class="layui-card-header">文章列表</div>
    <div class="layui-card-body">
      <!-- 操作区域 -->
      <form class="layui-form" id="formSearch">
        <div class="layui-form-item">
          <div class="layui-inline">
            <!-- 文章分类的下拉框区域 -->
            <div class="layui-input-inline" id="catesList"></div>
            <div class="layui-input-inline">
              <select name="state">
                <option value="">所有状态</option>
                <option value="已发布">已发布</option>
                <option value="草稿">草稿</option>
              </select>
            </div>
            <div class="layui-input-inline">
              <button class="layui-btn" lay-submit>筛选</button>
            </div>
          </div>
        </div>
      </form>

      <!-- 表格区域 -->
      <table class="layui-table">
        <colgroup>
          <col width="60%">
          <col width="11%">
          <col width="11%">
          <col width="11%">
          <col width="7%">
          <col>
        </colgroup>
        <thead>
          <tr>
            <th>文章标题</th>
            <th>分类</th>
            <th>发表时间</th>
            <th>状态</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody id="art-list-body"></tbody>
      </table>

      <!-- 分页区域 -->
      <div id="page-box"></div>

      <!-- 文章分类的模板结构 -->
      <script type="text/html" id="articleList">
        <select name="cate_id">
          <option value="">所有分类</option>
          {{each data item}}
          <option value="{{item.Id}}">{{item.name}}</option>
          {{/each}}
        </select>
      </script>

      <!-- 文章列表的模板结构 -->
      <script type="text/html" id="listClassification">
        {{each data item}}
        <tr>
          <td>{{item.title}}</td>
          <td>{{item.cate_name}}</td>
          <td>{{item.pub_date|dateFormat}}</td>
          <td>{{item.state}}</td>
          <td>
            <a href="./edit.html?id={{item.Id}}" class="layui-btn layui-btn-xs btn_edit" target="main_frame">编辑</a>
            <button type="button" class="layui-btn layui-btn-danger layui-btn-xs btn_delete"
              data-id="{{item.Id}}">删除</button>
          </td>
        </tr>
        {{/each}}
      </script>
    </div>
  </div>

  <script src="../assets/lib/jquery.js"></script>
  <script src="../assets/lib/layui/layui.all.js"></script>
  <script src="../assets/lib/template-web.js"></script>
  <script src="../assets/js/common.js"></script>
  <script src="../assets/js/article-lists.js"></script>
</body>

</html>